'use strict';

module.exports = {
  up: (queryInterface, Sequelize) => {
    /*
      Add altering commands here.
      Return a promise to correctly handle asynchronicity.

      Example:
      return queryInterface.createTable('users', { id: Sequelize.INTEGER });
    */
    const {
      DATE,
      STRING,
      DECIMAL,
    } = Sequelize;
    return queryInterface.createTable('alipays', {
      trade_no: STRING(65),
      out_trade_no: {
        type: STRING(65),
        primaryKey: true,
      },
      buyer_id: STRING(17),
      trade_status: STRING(33),
      total_amount: DECIMAL(10, 2),
      created_at: DATE,
      updated_at: DATE,
    });
  },

  down: queryInterface =>
    /*
      Add reverting commands here.
      Return a promise to correctly handle asynchronicity.

      Example:
      return queryInterface.dropTable('users');
    */
    queryInterface.dropTable('alipays')
  ,
};
